Skip to content

Complete improvements to the Falcon parser - #1117

Open
sirosen wants to merge 4 commits into
marshmallow-code:devfrom
sirosen:improve-falcon-story-pt2
Open

sirosen wants to merge 4 commits into
marshmallow-code:devfrom
sirosen:improve-falcon-story-pt2

Conversation

@sirosen

@sirosen sirosen commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

I've picked up the work started in #1080 and #1079, and tried to push it forward to a good place.
This is one of the things I want (which therefore became blocking) in the webargs 9.0 release, so I'd like to try to finalize the work.

I decided on a particular way of handling the multipart form issue, which is that it won't be explicitly handled at all, but since users can extend and customize the webargs parser, there are good workarounds for anyone who wants it.

vytas7 and others added 2 commits November 13, 2026 16:47
We can rely on Falcon's handling of form posts for `load_form` so long as
we define some parameters around it. Based on discussion, it seems like
the simplest option is to skip support for multipart forms, directing any
users to use `load_media` instead, and to make `load_form` use the
underlying `get_media` call after checking the content type.

The content-type check is the same loose one which was present before.

Remove the `parse_form_body` helper, as no longer needed.
@sirosen sirosen mentioned this pull request Nov 13, 2026
3 tasks
When used in an async parser / async app, it is possible for the falcon
parser's `load_form` to be called within an async app. In such a case,
`get_media()` returns an awaitable, and failing to handle this results
in an error.

1. Add a missing unit test which confirms that you can use the "form"
   location inside of an async application.

2. Wrap the result of `load_form()` as a coroutine to make it awaitable,
   where awaiting the coroutine awaits the underlying falcon-provided
   object.

In order to make (2) into a reusable paradigm, it's now implemented on
the base parser as a sibling of `_makeproxy` (which builds multidict
proxies), `_makeproxy_awaitable`.

Additionally, this improves the typing applied to `_makeproxy` as a
side-benefit from exploring better typing and overloads.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants